package day21.pack8;

import java.sql.Time;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class Test4 {
    public static void main(String[] args) {
        Runnable r = ()-> {
            System.out.println("线程任务执行中" + Thread.currentThread().getId());

            System.out.println("线程任务执行结束" + Thread.currentThread().getId());
        };


        ScheduledExecutorService executorService = Executors.newScheduledThreadPool(3);
        // 定时器
        // executorService.schedule(r, 3000, TimeUnit.MILLISECONDS);
        executorService.scheduleAtFixedRate(r, 3000, 5000, TimeUnit.MILLISECONDS);
    }
}
